#ifndef __LOG_H_INCLUDE__
#define __LOG_H_INCLUDE__

/* Error code in the project */
#define CALC_E_SUCCESS			0x00
#define CALC_E_BAD_FORMAT		0x01
#define CALC_E_NOT_ENOUGH_MEMORY	0x02
#define CALC_E_DIVIDED_BY_ZERO		0x03
#define CALC_E_OVER_FLOW		0x04
#define CALC_E_BAD_PARAMETER		0x05
#define CALC_E_INIT_FAILURE		0x06

/* only use low half byte */
#define LOG_DEBUG	0x01
#define LOG_INFO	0x02
#define LOG_WARN	0x03
#define LOG_ERR		0x04

/* only use high half byte */
#define LOG_NUM		0x10
#define LOG_SHELL	0x20
#define LOG_MAIN	0x30

#define LOG_L_BYTE(byte)	(0x0F & byte)
#define LOG_H_BYTE(byte)	(0xF0 & byte)

#define LOG_NUM_STR	"num"
#define LOG_SHELL_STR	"shell"
#define LOG_MAIN_STR	"main"

/* others may use below macro called `full level' for debugging */

/* number log */
#define LOG_NUM_ERR	(LOG_NUM | LOG_ERR)
#define LOG_NUM_WARN	(LOG_NUM | LOG_WARN)
#define LOG_NUM_INFO	(LOG_NUM | LOG_INFO)
#define LOG_NUM_DEBUG	(LOG_NUM | LOG_DEBUG)

/* shell log */
#define LOG_SHELL_ERR	(LOG_SHELL | LOG_ERR)
#define LOG_SHELL_WARN	(LOG_SHELL | LOG_WARN)
#define LOG_SHELL_INFO	(LOG_SHELL | LOG_INFO)
#define LOG_SHELL_DEBUG	(LOG_SHELL | LOG_DEBUG)

/* main log */
#define LOG_MAIN_ERR	(LOG_MAIN | LOG_ERR)
#define LOG_MAIN_WARN	(LOG_MAIN | LOG_WARN)
#define LOG_MAIN_INFO	(LOG_MAIN | LOG_INFO)
#define LOG_MAIN_DEBUG	(LOG_MAIN | LOG_DEBUG)

void calc_log(int full_lv, const char *format, ...);

#endif /* __LOG_H_INCLUDE__ */
